//package ProEva.db;

import java.sql.*;

public class DBSetting
{
	private static String DriverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
	
	private static StringBuffer Server;
	private static StringBuffer User;
	private static StringBuffer Password;
	
	public static void setServer( String newServer )
	{
		Server = new StringBuffer(newServer);
	}
	public static void setUser( String newUser )
	{
		User = new StringBuffer(newUser);
	}
	public static void setPassword( String Pass)
	{
		Password = new StringBuffer( Pass );
	}
	
	public static String getServer()
	{
		return Server.toString();
	}
	
	public static String getUser()
	{
		return User.toString();
	}
	
	public static String getPassword()
	{
		return Password.toString();
	}
	
	private static void Init()
	{
		//�˿ںŰ��Լ����������ý����޸�
		Server = new StringBuffer("jdbc:sqlserver://localhost:2111;DatabaseName=ProtectionEva");
		User = new StringBuffer("sa");
		Password = new StringBuffer("123456");
	}
	
	public static Connection GetConnection() throws Exception
	{
		Init();
		Class.forName( DriverName );
		try
		{
			Connection Conn = DriverManager.getConnection( getServer() , getUser() , getPassword() );
			return Conn;
		}
		catch( Exception e )
		{
			throw e;
		}
	}
}
